# -*- coding: utf-8 -*-
"""
Created on Mon Dec  6 10:06:17 2021

@author: Administrator
"""

import pandas as pd
import numpy as np
import os
import re

path = r'D:\_python\python\处理爱立信网管log'
os.chdir(path)

log_file = 'ExternalENodeBFunction.log'


with open(log_file,'r') as f:
    content = f.read()
    p1 = r'(=.+=\s(.+\s)=.+=\s(.+\s){28})' # 匹配单个邻区数据块的正则表达式
    matcher = re.compile(p1)
    res_all = matcher.findall(content)
res = [x[0] for x in res_all]

p2 = r'eNBId.+'  # 匹配基站代码的正则表达式
p3 = r'mcc.+'  # 匹配mcc的正则表达式
p4 = r'mnc.+'  # 匹配mnc的正则表达式
p4 = r'externalENodeBFunctionId.+(\d{4}-\d+)'  # 匹配mnc的正则表达式
for text in res:
    eNBid = re.match(p2,text).split('')